package com.lagou.edu.service.impl;

import com.lagou.edu.service.IEmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.stereotype.Service;


/**
 * @author 陶肖寅
 * @version V1.0
 * <p>
 *     验证码业务实现层
 * @date 2020-05-06 20:17
 * @email fromlx@126.com
 * @Copyright © 2020-2021 城云科技(中国)有限公司
 * </p>
 */
@Service
public class EmailService implements IEmailService {
    @Autowired
    private JavaMailSenderImpl javaMailSender;

    @Override
    public void sendEmail(String email, String code) {
        SimpleMailMessage smm = new SimpleMailMessage();
        smm.setSubject("验证码");
        smm.setText(code);
        smm.setTo(email);
        smm.setFrom("fromlx@126.com");
        javaMailSender.send(smm);
    }



}
